<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="cw" uri="/widget-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <cw:base/>
  </head>
  <body>
	<ul>
		<li>
			<b>表格可以使用cuteframework的统一异常处理框架展示异常信息，后台抛出Exception后，在前台的js中处理</b>
		</li>
		<li>
			<b>通过Wonders.grid.doQuery(formId, gridId, loadexception)方法延迟加载表格数据。
			参数loadexception为查询失败后的回调函数function(obj, options, response, e)，可以通过e.message获得异常errors列表</b>
		</li>
	</ul>
	<br/>
	<br/>
	<ul>
	<li>
	查询失败显示“莫名的错误!”
	<cw:form id="queryForm1">
		<cw:fieldSet title="查询明细">
   			<table>
   				<tr>
   					<td>姓名:</td>
   					<td><cw:text property="name"/></td>
   					<td><cw:button text="查询" onclick="query()"/></td>
   				</tr>
   			</table>
   		</cw:fieldSet>
   	</cw:form>
	<br/>
				<cw:grid id="grid1" title="加载异常表格"
					url="../../../../sample/grid/grid.queryError.action"
					enablePage="false" exportable="false" autoLoad="false">
					<cw:indexColumn />
					<cw:gridColumn property="id" width="60" title="编号" />
					<cw:gridColumn property="name" width="120" title="姓名" />
					<cw:gridColumn property="email" width="30%" />
					<cw:gridColumn property="age" width="80" title="年龄" />
					<cw:gridColumn property="birthday" width="120" dataType="date" format="Y-m-d" />
					<cw:gridColumn property="sex" width="80" rendererData="[[1,'男'],[2,'女']]" />
					<cw:gridColumn property="created" width="120" title="创建时间" dataType="date" format="Y-m-d" />
   				</cw:grid>
	<br/>
   	<div id="div1"></div>
	</li>
	</ul>
	<script type="text/javascript">
	    function query(){
	    	Wonders.grid.doQuery('queryForm1','grid1',loadexception);
	    }
			
			//查询失败操作，将错误信息打印出来
      	var loadexception = function(obj, options, response,e){
				var errors = e.message;
				for(var i=0;i<errors.length;++i){
					alert(errors[i].msg);
				}
		};
	</script>
  </body>
  <cw:theme></cw:theme>
 </html>
 